package org.dawning.shop.category.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.*;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;


/**
 * Created by fyx on 2016/6/24.
 */

@Configuration
@EnableSwagger2
@ComponentScan(value = {"org.dawning.*"})
public class SwaggerConfig {


    @Bean
    public Docket createRestApi() {
        HashSet protocols = new HashSet();
        protocols.add("http");
        return new Docket(DocumentationType.SWAGGER_2)
                .protocols(protocols)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("org.dawning.shop.category"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("类目服务")
                .description("...")
                .contact(new Contact("LangK","",""))
                .version("v1")
                .build();
    }


}


